#ifndef DATA_UPUP_H
#define DATA_UPUP_H

#include <QObject>
#include <QByteArray>

class Data_upup : public QObject
{
    Q_OBJECT
public:
    explicit Data_upup(QObject *parent = nullptr);

//接受数据
    int heart;//0:0x00：ROV设备状态正常
              //1:0x10：ROV设备初始化失败
              //2:0x11：ROV推进器电压电流异常
              //3:0x12：ROV传感器数据异常
              //4:0x13：ROV通信链路状态异常

    struct JY901S_data { //JY901数据包
        float x_jiao,y_jiao,z_jiao; //角速度
        float x_jia,y_jia,z_jia;    //加速度
        float x_ci,y_ci,z_ci;       //磁场
        float roll,pitch,yaw;       //角度
    }JY901s;

    struct MS5837_data { //MS5837数据包
        float deep,gage; //水深,水压
    }MS5837;

    float U_total;       //总电压
    float I_total;       //总电流

    float U_propeller1;  //1号推进器电压
    float U_propeller2;  //2号推进器电压
    float U_propeller3;  //3号推进器电压
    float U_propeller4;  //4号推进器电压
    float U_propeller5;  //5号推进器电压
    float U_propeller6;  //6号推进器电压
    float U_propeller7;  //7号推进器电压
    float U_propeller8;  //8号推进器电压

    float I_propeller1;  //1号推进器电流
    float I_propeller2;  //2号推进器电流
    float I_propeller3;  //3号推进器电流
    float I_propeller4;  //4号推进器电流
    float I_propeller5;  //5号推进器电流
    float I_propeller6;  //6号推进器电流
    float I_propeller7;  //7号推进器电流
    float I_propeller8;  //8号推进器电流

    int pwm_propeller1;  //1号推进器pwm数据
    int pwm_propeller2;  //2号推进器pwm数据
    int pwm_propeller3;  //3号推进器pwm数据
    int pwm_propeller4;  //4号推进器pwm数据
    int pwm_propeller5;  //5号推进器pwm数据
    int pwm_propeller6;  //6号推进器pwm数据
    int pwm_propeller7;  //7号推进器pwm数据
    int pwm_propeller8;  //8号推进器pwm数据

    struct AHT20_data {
        float qiya,temp,shidu;//舱内气压,温度,湿度
    }AHT20;

    struct JiXieBi_Data{
        float first,second; //1-2号电机角度数据
    }JiXieBi_data;

    struct YunTai_Data{
        float third,forth;  //3-4号电机角度数据
    }YunTai_data;

    int ShuiZhi;            //水质检测数据包

    float speed_x,speed_y,speed_z; //速度检测数据包

//发送控制命令
    struct JiXieBi_Command{
        int arm;  //1前伸,2停止,3回收
        int hand; //1抓取,2停止,3张开
    }JiXieBi_command;

    struct YunTai_Command {
        float x,y; //左右,上下转动数据
        int set;   //1锁定,2接触锁定,3复位,4转动
    };

    struct Light_Command {
        int command; //1开灯,2关灯
    }Light_command;

    struct Sport_Command {
        int mode;               //1定深模式,2平动模式,3转动模式
        float deep;             //定深的深度;
        float x,y,z;            //平动的x,y,z速度
        float roll,pitch,yaw;   //转动的角度
    }Sport_command;

//发送pid参数
    struct PID_DATA {
        float p,i,d;
    }pid_1,pid_2,pid_3;

signals:
    void signal_send_JiXieBi_arm(QByteArray data_send);
    void signal_send_JiXieBi_hand(QByteArray data_send);
    void signal_send_YunTai(QByteArray data_send);
    void signal_send_Light(QByteArray data_send);
    void signal_send_Sport(QByteArray data_send);
    void signal_send_Pid(QByteArray data_send);             //done
};

#endif // DATA_UPUP_H
